package com.youzi.tunnel.client;


import com.youzi.tunnel.client.config.ClientProperties;
import com.youzi.tunnel.client.manager.ChannelManager;
import com.youzi.tunnel.client.manager.ClientManager;
import com.youzi.tunnel.client.manager.FutureManager;
import com.youzi.tunnel.client.manager.TunnelManager;
import com.youzi.tunnel.client.work.ClientStarter;

public class ClientApplication {

    public static void main(String[] args) {
        start(null, null);
    }

    public static void start(String host, Integer port) {
        if (host != null) {
            ClientProperties.getInstance().setServerHost(host);
        }
        if (port != null) {
            ClientProperties.getInstance().setServerPort(port);
        }
        ClientStarter.start();
    }

    public static void stop() {
        ChannelManager.closeAll();
        FutureManager.closeAll();
        ClientManager.removeClient();
        TunnelManager.removeAll();
    }

}
